how to solve complementary function